Generalized synchronous/asynchronous, blocking/ non-blocking
Synchronous vs Asynchronous (synchronous vs asynchronous)
A message communication mechanism that synchronizes and asynchronously concerns.
Synchronization and Asynchrony are just the mechanisms for how messages of concern are notified. In the case of synchronization, it is up to the handler to wait for the message to be triggered (take the initi
(1) Blocking blockBlocking mode block, as the name suggests, is when processes or threads execute to these functions must wait for an event to occur, and if the event does not occur, the process or thread is blocked and the function cannot be returned immediately.For example, in the socket programming connect, accept, recv, recvfrom such blocking program.As with most function calls, statement execution, str
Non-Blocking Algorithm
In computer science,Non-Blocking AlgorithmEnsures that threads competing for a shared resource do not have their execution indefinitely postponed by mutual exclusion. A non-blockingalgorithm isLock-freeIf there is guaranteed system-wide progress regardless of scheduling;Wait-freeIf there is also guaranteed per-thread progress.
Literature up to the turn of the 21st century used "non-
Non-blocking of synchronous asynchronous blocking; analysis of asynchronous Blocking
Let's talk about the meaning of these words.Synchronization:Synchronization is a task that depends on another task. Only after the dependent task is completed can the task be completed.Asynchronous:Asynchronous mode does not need to wait for the dependent task to complete, but on
Blocking functions: Connect, Accept,send/recv/sendto/recvfrom and other read-write functions.Functions that do not block: Bind, Listen,socket, closesocket.The Linux network communication model is:Blocking IO Model (synchronous), non-blocking IO model (copy synchronization), IO multiplexing model (multithreaded synchronization), signal driven IO model (copy synchronization), Asynchronous IO Model (async).nod
requires a new row to hold the calculated aggregate value.
So in contrast, in general, the synchronization component is faster than the asynchronous component because it can reuse the input cache, because the asynchronous component needs a new cache to complete the output.
Observation of the data source components, which are asynchronous types, because they need to create two caches, one is the output of the successful one is the error output, all the target destination components are synchro
Recv send blocking and non-blocking, recvsend Blocking
Nt send (SOCKET s, const char FAR * buf, int len, int flags );
Both the client and server applications use the send function to send data to the other end of the TCP connection. The client program generally uses the send function to send requests to the server, while the server uses the send function to send
Preface:
If a transaction is waiting for a resource that is locked for another transaction. This transaction becomes a "blocked transaction". In turn, a blocking transaction, that is, a transaction that locks resources and causes other transactions to wait is called a "blocking transaction."
Long-running transactions can block other transactions and queries, making them wait for long periods of time. In he
Nested div elements. If the parent and child elements are bound to some events, the parent element event may be triggered when you click the child element at the inmost layer, the following is an example of js blocking default events and js blocking event bubbling. For more information, see section 1. event. preventDefault (); -- blocks default events of elements.
Note: The default event for clicking to jum
Preface:
If a transaction is waiting for a resource that is locked for another transaction. This transaction becomes a "blocked transaction". In turn, a blocking transaction, that is, a transaction that locks resources and causes other transactions to wait is called a "blocking transaction."
Long-running transactions can block other transactions and queries, making them wait for long periods of time. In he
1. Conceptual understanding
In the case of network programming, we often see synchronous (Sync)/asynchronous (Async), blocking (block)/non-blocking (Unblock) Four ways to invoke: Sync:
synchronization is
when a function call is issued, and the call does not return until the result is obtained.
It is necessary to do one thing, and so on before the next thing is
, it is not directly to receive the data but to create a callback function. Callback functions are maintained by the system. He automatically scans the data store at the specified time. If there is data, he stores the data in the specified byte array. Without the user to care.
Second explanation:
One, to give a call example:Blocking block is when you dial someone's phone, but the person is not there, so you take the phone and wait for him to come back, and you can't use the phone. The synchroniz
asynchronous calls, the return of the call is not controlled by the caller.For the three ways to notify callers, the following is the case:StateThat is, listening to the status of the callee (polling), the caller needs to check every time, the efficiency will be very low.NoticeWhen the callee executes, a notification informs the caller that there is no need to consume too much performance.CallbackSimilar to notifications, when the callee executes, it invokes the callback function provided by th
Synchronous and asynchronous: related to the notification mechanism of a message .
Essential differences
Practical examples
Sync mode
To wait for the message to be triggered by the person handling the message
I go to the bank to handle business, choose to queue, etc., row to the end of the deal.
Asynchronous mode
By triggering mechanism to notify the person who processed the message
I went to the bank to transact busine
blocking Mode
Windows Sockets perform I/O operations in both blocking and non-blocking modes. In blocking mode, the action function that executes until the I/O operation is complete waits without immediate return, and the thread where the function is located is blocked here. Instead, in nonblocking mode, the socket f
These two articles analyze 5 kinds of IO models under Linux
http://blog.csdn.net/historyasamirror/article/details/5778378
http://blog.csdn.net/hguisu/article/details/7453390
Many people do not understand the concept of blocking/non-blocking, synchronous/asynchronous, do not know the difference between non-blocking and asynchronous Io, and generally think that no
Blocking is a common scenario for DBAs, especially where poor application design blocking can cause severe performance degradation until the database crashes. For DBAs, it is necessary to know how to navigate to what is blocking the current system, who is the blocking, and who is the blocked. This paper gives a descrip
requests.1. Blocking Code Instancesvar fs = require ("fs"); var data = Fs.readfilesync ('input.txt'); Console.log (data.tostring ()); Console.log (" program execution is over! ") " ); // Result: The contents of input are printed first, and then the printing program ends.2. Non-blocking code instances var fs = require ( " fs " " Input.txt " , function (err, data) { Span style= "COLOR: #0000ff" >if
We do some more work for the client's writing. This time we use non-blocking IO to implement the Connect function. int Connect (intconststruct sockaddr *addr, socklen_t Addrlen);Non-blocking IO has the following uses:
1. The process of three handshake is born, and other things are handled.
2. Use this to establish multiple connections at the same time.
3. To implement the Timeout connect fu
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.